<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateShopSelfCheckNotifyConfig extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('cruise_shop_self_check_notify_config', function (Blueprint $table) {
            $table->id();
            $table->unsignedInteger('shopId')->default(0)->comment('门店id');
            $table->tinyInteger('notifySwitch')->default(1)->comment('提醒开关:0关闭,1开启');

            $table->json('notifyRoles')->nullable()->comment('提醒角色:1-店长和老板,2-店员,3-自动匹配早晚班员工');
            $table->json('notifyType')->nullable()->comment('提醒方式:1-app,2-短信');
            $table->tinyInteger('kdNotifyTimeMap')->default(1)->comment('开档提醒时间map');

            $table->tinyInteger('sdNotifyTimeMap')->default(2)->comment('收档提醒时间map');

            $table->tinyInteger('weekNotifyTimeMap')->default(3)->comment('周检提醒时间map');

            $table->tinyInteger('monthNotifyTimeMap')->default(4)->comment('月检提醒时间map');

            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedAt')->default(0)->comment('修改时间');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('修改人');
            $table->index('shopId','idx_shopId');

            $table->collation = 'utf8mb4_general_ci';
            $table->comment = '门店自检-提醒配置';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('shop_check_notify_setting');
    }
}
